
const gcj2bdString = (lng, lat, mapType) => {
  var x_pi = 3.14159265358979324 * 3000.0 / 180.0;
      if (mapType == 'BAIDU') {
          var x = lng, y = lat;
          var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
          var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
          // this.position.currentLng = z * Math.cos(theta) + 0.0065
          // this.position.currentLat = z * Math.sin(theta) + 0.006
          return [z * Math.cos(theta) + 0.0065, z * Math.sin(theta) + 0.006]
      } else if (mapType == 'GAODE') {
          var x = lng - 0.0065, y = lat - 0.006;
          var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
          var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
          // this.position.currentLng = z * Math.cos(theta)
          // this.position.currentLat = z * Math.sin(theta)
          return [z * Math.cos(theta), z * Math.sin(theta)]
      }
}
module.exports = {
  gcj2bdString,
}